package com.lzq.model.singleton;

/**
 * @author : modify
 * @version : v1.0
 * @description :
 * @createTime : 2022/11/13 16:37
 * @updateUser : modify
 * @updateTime : 2022/11/13 16:37
 * @updateRemark : 懒汉式
 */
public class LazyStyleVar {
    private LazyStyleVar() {
    }

    private static LazyStyleVar lazyStyleVar;

    public static synchronized LazyStyleVar getInstance() {
        if (lazyStyleVar == null) {
            lazyStyleVar = new LazyStyleVar();
        }
        return lazyStyleVar;
    }
}

class TestLazyVar {
    public static void main(String[] args) {
        LazyStyleVar instance = LazyStyleVar.getInstance();
        LazyStyleVar instance1 = LazyStyleVar.getInstance();
        System.out.println(instance == instance1);
    }
}